package org.blogsomy.controller.admin;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.blogsomy.controller.BaseController;
import org.blogsomy.model.entities.User;

import com.google.code.lightsomy.annotations.Action;
import com.google.code.lightsomy.annotations.BeforeAction;
import com.google.code.lightsomy.annotations.Controller;

@Controller
public class IndexController extends BaseController {

	private User user;
	
	@BeforeAction
	public void prepare(HttpServletRequest req, HttpServletResponse res) {
		user = getUser(req);
	}
	
	@Action
	public void index(HttpServletRequest req, HttpServletResponse res) throws IOException {
		res.getWriter().append("Hello ");
		res.getWriter().append(user.getRealname());
		res.getWriter().append(" ");
		res.getWriter().append(user.getSurname());
	}
}
